package com.study.spmongodb.wwj.thread2.char11;

/**
 * @author MI
 * @version 1.0
 * @date 2020/12/8 21:22
 */
public final class ActionContext {

    private static final ThreadLocal<Context> threadlocal = new ThreadLocal() {
        @Override
        protected Object initialValue() {
            return new Context();
        }
    };

    private static class ContextHolder {
        private final static ActionContext actionContext = new ActionContext();
    }

    public static ActionContext getActionContext() {
        return ContextHolder.actionContext;
    }

    public Context getContext() {
        return threadlocal.get();
    }
}
